package com.aaa.outbound.mapper;

import com.aaa.entity.outbound.Outorder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author wjf
 * @since 2020-11-23
 */
@Mapper
@Component
public interface OutorderMapper extends BaseMapper<Outorder> {
    List<Map> findCity();
    List<Map> findState();
    @Select("select id from o_outorder where outorderno=#{outorderno}")
    Outorder selectIdByOutorderno(String outorderno);
    @Select("select p.picktaskno from o_picktask p\n" +
            "join o_picktask_outorder po on po.picktaskid=p.id\n" +
            "join o_outorder o on o.id=po.outorderid\n" +
            "where o.outorderno=#{outorderno}")
    String selectPicktasknoByOutorderno(String outorderno);

    @Select("select id,cityname from city where type=1")
    List<Map> findAllSheng();

    @Select("select c.id,c.cityname from city c,\n" +
            "(select id from city where cityname=#{cityname}) a where c.pid = a.id")
    List<Map> findAllShiById(String cityname);

    @Select("select c.id,c.cityname from city c,\n" +
            "(select id from city where cityname=#{cityname}) a where c.pid = a.id")
    List<Map> findAllXianById(String cityname);
}
